﻿using LoginModule.DbContexts;
using Microsoft.EntityFrameworkCore;
using MonitorModule.DbContexts;
using MonitorModule.UserControls;
using MonitorModule.ViewModels;
using MonitorModule.Views;
using Prism.Ioc;
using Prism.Modularity;
using StaffModule.DbContexts;
using System;
using System.Configuration;

namespace MonitorModule {
    public class MonitorProfile : IModule {
        //初始化
        public void OnInitialized(IContainerProvider containerProvider) {
        }
        //依赖注入
        public void RegisterTypes(IContainerRegistry containerRegistry) {

            containerRegistry.RegisterScoped<MonitorDbContext>(provider => {
                var optionsBuilder = new DbContextOptionsBuilder<MonitorDbContext>();
                optionsBuilder.UseSqlite("Data Source=D:\\Projects\\sqlite\\monitor.db;");
                return new MonitorDbContext(optionsBuilder.Options);
            });

            containerRegistry.RegisterForNavigation<MonitorUC, MonitorUCViewModel>();
            containerRegistry.RegisterForNavigation<RaderUC>();
            containerRegistry.RegisterForNavigation<Settings, SettingsViewModel>();


        }
    }
}